package com.example.chao.myphotosearch.widget;

import android.content.Context;
import android.widget.Toast;

import com.example.chao.myphotosearch.PhotoSearchApp;

/**
 * Created by liukun on 16/3/8.
 */
public final class UIToast {

    private static Context context = PhotoSearchApp.getInstance().getApplicationContext();

    public static void showToastLong(String msg) {
        showToast(context, msg, Toast.LENGTH_LONG);
    }

    public static void showToastShort(String msg) {
        showToast(context, msg, Toast.LENGTH_SHORT);
    }

    public static void showToastShort(int strRes) {
        showToast(context, context.getString(strRes), Toast.LENGTH_SHORT);
    }

    public static void showToastLong(int strRes) {
        showToast(context, context.getString(strRes), Toast.LENGTH_LONG);
    }

    private static void showToast(Context context, String msg, int duration) {
        Toast.makeText(context, msg, duration).show();
    }

}
